package com.guigu.wenzhiyi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.liuzhireng.pojo.PageVo;
import com.guigu.wenzhiyi.mapper.MmanufactureMapper;
import com.guigu.wenzhiyi.pojo.Mmanufacture;
import com.guigu.wenzhiyi.service.MmanufactureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MmanufactureServiceImpl implements MmanufactureService {

    @Autowired
    MmanufactureMapper mmanufactureMapper;

    @Override
    public int insert(Mmanufacture mmanufacture) {
        mmanufactureMapper.insert(mmanufacture);
        return mmanufacture.getId();
    }

    @Override
    public int updateWZY_SH_ZT(Mmanufacture mmanufacture) {
        return mmanufactureMapper.updateWZY_SH_ZT(mmanufacture);
    }

    @Override
    public int updateWZY(Mmanufacture mmanufacture) {
        return mmanufactureMapper.updateByPrimaryKeySelective(mmanufacture);
    }

    @Override
    public List<Mmanufacture> mManufactureWZY_SH() {
        return mmanufactureMapper.mManufactureWZY_SH();
    }

    @Override
    public Mmanufacture mManufactureWZY_SH_list(Integer id) {
        return mmanufactureMapper.mManufactureWZY_SH_list(id);
    }

    @Override
    public List<Mmanufacture> MmanufactureWZY_Cha(Mmanufacture mmanufacture) {
        return mmanufactureMapper.MmanufactureWZY_Cha(mmanufacture);
    }

    @Override
    public PageVo<Mmanufacture> MmanufactureWZY_DengJi_Cha_Page(int num, int size, Mmanufacture mmanufacture) {
        PageHelper.startPage(num,size);
        List<Mmanufacture> list = mmanufactureMapper.MmanufactureWZY_DengJi_Cha(mmanufacture);
        PageInfo<Mmanufacture> pageInfo = new PageInfo<>(list);
        PageVo<Mmanufacture> pageVo = new PageVo<>();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }

    @Override
    public PageVo<Mmanufacture> MmanufactureWZY_DengJi_SH_Page(int num, int size,Mmanufacture mmanufacture) {
        PageHelper.startPage(num,size);
        List<Mmanufacture> list = mmanufactureMapper.MmanufactureWZY_DengJi_SH_Page(mmanufacture);
        PageInfo<Mmanufacture> pageInfo = new PageInfo<>(list);
        PageVo<Mmanufacture> pageVo = new PageVo<>();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }

    @Override
    public PageVo<Mmanufacture> MmanufactureWZY_Cha_Page(int num, int size, Mmanufacture mmanufacture) {
        PageHelper.startPage(num,size);
        List<Mmanufacture> list = mmanufactureMapper.MmanufactureWZY_Cha_Page(mmanufacture);
        PageInfo<Mmanufacture> pageInfo = new PageInfo<>(list);
        PageVo<Mmanufacture> pageVo = new PageVo<>();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }


}
